package rnavigator.model;

import rnavigator.controller.*;
import rnavigator.model.IOHandler;
import rnavigator.model.Model;
import rnavigator.model.Structure;
import rnavigator.view.StructurePanel;
import rnavigator.view.View;

/**
 *
 * @author Elias la Cour
 * @Initializer class for basic startup stuff
 */
public class Initializer {

    private Structure structure = null;
    private boolean debug = false;
    Controller controller = null;
    Model model = null;
    View view = null;
    IOHandler ioHandler = null;
    //StructurePanel structurePanel = null;

    public Initializer() {
    }

    public Initializer(boolean debug) {
        this.debug = debug;
    }

    protected void initialize() {
        controller = new Controller();
        model = new Model();
        ioHandler = new IOHandler();
        addStructure();
        
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new View().setVisible(true);
            }
        });

        //setDebugForAll(false);
        if (debug) {
            System.out.println("Debug mode activated");
        }
    }
    //creates a structure object

    public void addStructure() {
        structure = ioHandler.smallInput();
        structure = model.createStructure(structure);
        structure = model.modelCircularFeynmanUnitCircle(structure);
        model.setStructure(structure);
        //view.createFramework();
        //view.setStructure(structure);
        //view.repaint();
    }
}
